#include<iostream>
#include<cmath>
using namespace std;
int JudgeSushu(int i)
{
   int k=sqrt(i);
   for(int j=2;j<=k;j++)
   {
     if(i%j==0)
		 return 0;
   }
   return 1;
}
int main()
{
	int count=0;
  for(int i=1;i<=1000;i++)
  {
      if(JudgeSushu(i))
	  {
	     cout<<i<<' ';
		 count++;
		 if(count%5)
			 continue;
		 cout<<endl;
	  }
  }
  return 0;
}